package com.acp.service.impl;

import com.acp.context.Config;
import com.acp.dao.acpo.DcsTaskMapper;
import com.acp.dao.acpo.DcsTaskPerformanceMapper;
import com.acp.dao.acpo.ObjectManagerMapper;
import com.acp.dao.acpo.ObjectNumberMapper;
import com.acp.model.DcsTask;
import com.acp.model.DcsTaskPerformance;
import com.acp.model.ObjectManager;
import com.acp.model.ObjectNumber;
import com.acp.result.ResultInfo;
import com.acp.result.ResultUtil;
import com.acp.service.DcsTaskPerfoemanceService;
import com.alibaba.fastjson.JSON;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * All rights Reserved, Designed By 姑苏区政府大数据中心
 *
 * @version V1.0
 * @Title: null.java
 * @Package com.dci.controller.construction
 * @Description: 任务绩效实现类
 * @author: 张星亮
 * @date: 2019/4/5
 * @Copyright: 2019 姑苏区政府大数据中心. All rights reserved.
 * 注意：本内容仅限于姑苏区政府大数据中心内部传阅，禁止外泄以及用于其他的商业目
 */
@Service
public class DcsTaskPerformanceServiceImpl implements DcsTaskPerfoemanceService {

    @Resource
    private DcsTaskPerformanceMapper dcsTaskPerformanceMapper;

    @Resource
    private DcsTaskMapper dcsTaskMapper;

    @Resource
    private ObjectManagerMapper objectManagerMapper;

    @Resource
    private ObjectNumberMapper objectNumberMapper;

    /**
     * 查询所有
     * @param group_code
     * @return 返回list集合
     */
    @Override
    public List<DcsTaskPerformance> selectAll(String group_code) {
        List<DcsTaskPerformance> list = dcsTaskPerformanceMapper.selectAll(group_code);
        List<DcsTaskPerformance> list1 = new ArrayList<>();
        if (list.size() > 0) {
            for (DcsTaskPerformance performance : list) {
                DcsTask dcsTask = dcsTaskMapper.selectByCode(performance.getTask());
                if (dcsTask != null) {
                    performance.setTask_name(dcsTask.getTask_name());
                    list1.add(performance);
                }
            }
        }

        return list1;
    }

    /**
     * 工具方法
     * @param object
     * @param type
     * @return String 类型字符串
     */
    private String doValue(String object, String type) {
        String value;
        try {
            Map mapObject = (Map) JSON.parse(object);
            value = mapObject.get(type).toString();
        } catch (Exception ex) {
            value = "";
        }

        return value;
    }

    /**
     * 修改
     * @param object
     * @return 返回ResultInfo 封装的返回参数  保存成功msg:906 保存失败msg:911
     */
    @Override
    public ResultInfo updateScore(String object) {
        String score = doValue(object, "score");
        String id = doValue(object, "id");
        String evaluate = doValue(object, "evaluate");
        DcsTaskPerformance dcsTaskPerformance = DcsTaskPerformance.builder().id(id).score(score).evaluate(evaluate).build();
        dcsTaskPerformanceMapper.updateScore(dcsTaskPerformance);
        return ResultUtil.createSuccess(Config.MESSAGE, 906, null);
    }


    /**
     * 查询
     * @return list集合
     */
    @Override
    public List<ObjectManager> selectObject(String date) {
        List<ObjectManager> list1 = new ArrayList<>();
        ObjectManager objectManager1 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("传统产业").table_name("traditional_industry").build();
        list1.add(objectManager1);
        ObjectManager objectManager2 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("历史文化街区").table_name("historical_street").build();
        list1.add(objectManager2);
        ObjectManager objectManager3 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("古城墙").table_name("old_wall").build();
        list1.add(objectManager3);
        ObjectManager objectManager4 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("历史地段").table_name("historical_area").build();
        list1.add(objectManager4);
        ObjectManager objectManager5 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("工业遗产").table_name("industrial_heritage").build();
        list1.add(objectManager5);
        ObjectManager objectManager6 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("古树名木").table_name("old_tree").build();
        list1.add(objectManager6);
        ObjectManager objectManager7 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("河道水系").table_name("watercourse").build();
        list1.add(objectManager7);
        ObjectManager objectManager8 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).name("历史建筑").table_name("historical_building").build();
        list1.add(objectManager8);
        ObjectManager objectManager9 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("非物质文化遗产").table_name("nch").build();
        list1.add(objectManager9);
        ObjectManager objectManager10 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("古构筑物").table_name("old_structure").build();
        list1.add(objectManager10);
        ObjectManager objectManager11 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("地下文物埋藏区").table_name("uar").build();
        list1.add(objectManager11);
        ObjectManager objectManager12 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("传统民居").table_name("traditional_houses").build();
        list1.add(objectManager12);
        ObjectManager objectManager13 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("文控保单位").table_name("protection_unit").build();
        list1.add(objectManager13);
        ObjectManager objectManager14 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("尚未核定为文物保护单位的不可移动文物").table_name("ucr").build();
        list1.add(objectManager14);
        ObjectManager objectManager15 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("苏州园林").table_name("suzhou_gardens").build();
        list1.add(objectManager15);
        ObjectManager objectManager16 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("吴文化地名").table_name("wu_culture_place").build();
        list1.add(objectManager16);
        ObjectManager objectManager17 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("近现代重要史迹及代表性建筑").table_name("hsataoc").build();
        list1.add(objectManager17);
        ObjectManager objectManager18 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).rejectCount(0).addCount(0).updateCount(0).name("其他").table_name("others").build();
        list1.add(objectManager18);

        String sTime = doValue(date, "startTime");
        String eTime = doValue(date, "endTime");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date startTime = null;
        Date endTime = null;
        Date endT = null;
        try {
            startTime = sdf.parse(sTime);
        } catch (ParseException e) {
            startTime = null;
        }
        try {
            endT = sdf.parse(eTime);
            Calendar cal = Calendar.getInstance();
            cal.setTime(endT);
            cal.add(Calendar.DATE, 1);
            endTime = sdf.parse(sdf.format(cal.getTime()));
        } catch (ParseException e) {
            endTime = null;
        }
        List<ObjectManager> list = objectManagerMapper.selectObject();
        if (list.size() > 0) {
            for (ObjectManager objectManager : list) {
                ObjectNumber objectNumber1 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("待审核").num0("1").num1(null).num2(null).num3(null).startTime(startTime).endTime(endTime).build();
                ObjectNumber objectNumber2 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("待入库").num0(null).num1("1").num2(null).num3(null).startTime(startTime).endTime(endTime).build();
                ObjectNumber objectNumber3 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("已入库").num0(null).num1(null).num2("1").num3(null).startTime(startTime).endTime(endTime).build();

                ObjectNumber objectNumber5 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("已入库").operation("新增").num0(null).num1(null).num2("1").num3(null).startTime(startTime).endTime(endTime).build();
                ObjectNumber objectNumber6 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("已入库").operation("更新").num0(null).num1(null).num2("1").num3(null).startTime(startTime).endTime(endTime).build();

                ObjectNumber objectNumber4 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("未通过审核").num0(null).num1(null).num2(null).num3("1").startTime(startTime).endTime(endTime).build();
                switch (objectManager.getTable_name()) {
                    case "traditional_industry":
                        list1.get(0).setCount(objectManager.getCount());
                        list1.get(0).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(0).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(0).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(0).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(0).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(0).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "historical_street":
                        list1.get(1).setCount(objectManager.getCount());
                        list1.get(1).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(1).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(1).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(1).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(1).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(1).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "old_wall":
                        list1.get(2).setCount(objectManager.getCount());
                        list1.get(2).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(2).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(2).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(2).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(2).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(2).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "historical_area":
                        list1.get(3).setCount(objectManager.getCount());
                        list1.get(3).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(3).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(3).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(3).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(3).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(3).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "industrial_heritage":
                        list1.get(4).setCount(objectManager.getCount());
                        list1.get(4).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(4).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(4).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(4).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(4).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(4).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "old_tree":
                        list1.get(5).setCount(objectManager.getCount());
                        list1.get(5).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(5).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(5).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(5).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(5).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(5).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "watercourse":
                        list1.get(6).setCount(objectManager.getCount());
                        list1.get(6).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(6).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(6).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(6).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(6).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(6).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "historical_building":
                        list1.get(7).setCount(objectManager.getCount());
                        list1.get(7).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(7).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(7).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(7).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(7).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(7).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "nch":
                        list1.get(8).setCount(objectManager.getCount());
                        list1.get(8).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(8).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(8).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(8).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(8).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(8).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "old_structure":
                        list1.get(9).setCount(objectManager.getCount());
                        list1.get(9).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(9).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(9).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(9).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(9).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(9).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "uar":
                        list1.get(10).setCount(objectManager.getCount());
                        list1.get(10).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(10).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(10).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(10).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(10).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(10).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "traditional_houses":
                        list1.get(11).setCount(objectManager.getCount());
                        list1.get(11).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(11).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(11).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(11).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(11).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(11).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "protection_unit":
                        list1.get(12).setCount(objectManager.getCount());
                        list1.get(12).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(12).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(12).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(12).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(12).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(12).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "ucr":
                        list1.get(13).setCount(objectManager.getCount());
                        list1.get(13).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(13).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(13).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(13).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(13).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(13).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "suzhou_gardens":
                        list1.get(14).setCount(objectManager.getCount());
                        list1.get(14).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(14).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(14).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(14).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(14).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(14).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "wu_culture_place":
                        list1.get(15).setCount(objectManager.getCount());
                        list1.get(15).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(15).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(15).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(15).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(15).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(15).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "hsataoc":
                        list1.get(16).setCount(objectManager.getCount());
                        list1.get(16).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(16).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(16).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(16).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(16).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(16).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    case "others":
                        list1.get(17).setCount(objectManager.getCount());
                        list1.get(17).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(17).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(17).setInCount(objectNumberMapper.selectNumber(objectNumber3));

                        list1.get(17).setAddCount(objectNumberMapper.selectNumber(objectNumber5));
                        list1.get(17).setUpdateCount(objectNumberMapper.selectNumber(objectNumber6));

                        list1.get(17).setRejectCount(objectNumberMapper.selectNumber(objectNumber4));
                        break;
                    default:
                        break;
                }

            }
        }
        return list1;
    }

    /**
     * 时间查询
     * @param object
     * @return 返回list集合
     */
    @Override
    public List<ObjectManager> selectObjectByTime(String object) {
        String statTime = doValue(object, "statTime");
        String endTime = doValue(object, "endTime");

        List<ObjectManager> list1 = new ArrayList<>();
        ObjectManager objectManager1 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("传统产业").table_name("traditional_industry").build();
        list1.add(objectManager1);
        ObjectManager objectManager2 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("历史文化街区").table_name("historical_street").build();
        list1.add(objectManager2);
        ObjectManager objectManager3 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("古城墙").table_name("old_wall").build();
        list1.add(objectManager3);
        ObjectManager objectManager4 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("历史地段").table_name("historical_area").build();
        list1.add(objectManager4);
        ObjectManager objectManager5 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("工业遗产").table_name("industrial_heritage").build();
        list1.add(objectManager5);
        ObjectManager objectManager6 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("古树名木").table_name("old_tree").build();
        list1.add(objectManager6);
        ObjectManager objectManager7 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("河道水系").table_name("watercourse").build();
        list1.add(objectManager7);
        ObjectManager objectManager8 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("历史建筑").table_name("historical_building").build();
        list1.add(objectManager8);
        ObjectManager objectManager9 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("非物质文化遗产").table_name("nch").build();
        list1.add(objectManager9);
        ObjectManager objectManager10 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("古构筑物").table_name("old_structure").build();
        list1.add(objectManager10);
        ObjectManager objectManager11 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("地下文物埋藏区").table_name("uar").build();
        list1.add(objectManager11);
        ObjectManager objectManager12 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("传统民居").table_name("traditional_houses").build();
        list1.add(objectManager12);
        ObjectManager objectManager13 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("文控保单位").table_name("protection_unit").build();
        list1.add(objectManager13);
        ObjectManager objectManager14 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("尚未核定为文物保护单位的不可移动文物").table_name("ucr").build();
        list1.add(objectManager14);
        ObjectManager objectManager15 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("苏州园林").table_name("suzhou_gardens").build();
        list1.add(objectManager15);
        ObjectManager objectManager16 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("吴文化地名").table_name("wu_culture_place").build();
        list1.add(objectManager16);
        ObjectManager objectManager17 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("近现代重要史迹及代表性建筑").table_name("hsataoc").build();
        list1.add(objectManager17);
        ObjectManager objectManager18 = ObjectManager.builder().count(0).auditCount(0).inCount(0).putCount(0).name("其他").table_name("others").build();
        list1.add(objectManager18);


        List<ObjectManager> list = objectManagerMapper.selectObject();
        if (list.size() > 0) {
            for (ObjectManager objectManager : list) {
                ObjectNumber objectNumber1 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("待审核").build();
                ObjectNumber objectNumber2 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("待入库").build();
                ObjectNumber objectNumber3 = ObjectNumber.builder().tableName(objectManager.getTable_name()).status("已入库").build();
                switch (objectManager.getTable_name()) {
                    case "traditional_industry":
                        list1.get(0).setCount(objectManager.getCount());
                        list1.get(0).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(0).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(0).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "historical_street":
                        list1.get(1).setCount(objectManager.getCount());
                        list1.get(1).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(1).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(1).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "old_wall":
                        list1.get(2).setCount(objectManager.getCount());
                        list1.get(2).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(2).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(2).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "historical_area":
                        list1.get(3).setCount(objectManager.getCount());
                        list1.get(3).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(3).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(3).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "industrial_heritage":
                        list1.get(4).setCount(objectManager.getCount());
                        list1.get(4).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(4).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(4).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "old_tree":
                        list1.get(5).setCount(objectManager.getCount());
                        list1.get(5).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(5).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(5).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "watercourse":
                        list1.get(6).setCount(objectManager.getCount());
                        list1.get(6).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(6).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(6).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "historical_building":
                        list1.get(7).setCount(objectManager.getCount());
                        list1.get(7).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(7).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(7).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "nch":
                        list1.get(8).setCount(objectManager.getCount());
                        list1.get(8).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(8).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(8).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "old_structure":
                        list1.get(9).setCount(objectManager.getCount());
                        list1.get(9).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(9).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(9).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "uar":
                        list1.get(10).setCount(objectManager.getCount());
                        list1.get(10).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(10).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(10).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "traditional_houses":
                        list1.get(11).setCount(objectManager.getCount());
                        list1.get(11).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(11).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(11).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "protection_unit":
                        list1.get(12).setCount(objectManager.getCount());
                        list1.get(12).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(12).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(12).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "ucr":
                        list1.get(13).setCount(objectManager.getCount());
                        list1.get(13).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(13).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(13).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "suzhou_gardens":
                        list1.get(14).setCount(objectManager.getCount());
                        list1.get(14).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(14).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(14).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "wu_culture_place":
                        list1.get(15).setCount(objectManager.getCount());
                        list1.get(15).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(15).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(15).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "hsataoc":
                        list1.get(16).setCount(objectManager.getCount());
                        list1.get(16).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(16).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(16).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    case "others":
                        list1.get(17).setCount(objectManager.getCount());
                        list1.get(17).setAuditCount(objectNumberMapper.selectNumber(objectNumber1));
                        list1.get(17).setPutCount(objectNumberMapper.selectNumber(objectNumber2));
                        list1.get(17).setInCount(objectNumberMapper.selectNumber(objectNumber3));
                        break;
                    default:
                        break;
                }

            }
        }
        return list1;
    }
}
